package com.wechat.pojo;

import lombok.*;

import javax.xml.bind.annotation.*;
import java.io.Serializable;
import java.util.List;

/**
 * @author why
 * @date 2017/12/20 0020
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "xml")
// 控制JAXB 绑定类中属性和字段的排序
/*@XmlType(propOrder = {
        "toUserName",
        "fromUserName",
        "createTime",
        "msgType",
        "image",
})*/
@Data
@AllArgsConstructor(access = AccessLevel.PUBLIC)
@NoArgsConstructor(access = AccessLevel.PUBLIC)
public class WechatImageMessage extends WechatMessage implements Serializable {
    private static final long serialVersionUID = -1740773539514531632L;

    public WechatImageMessage(String toUserName, String fromUserName, String createTime, String msgType, List<WechatImageMessage.Image> image) {
        super(toUserName, fromUserName, createTime, msgType);
        this.image = image;
    }

    @NonNull
    @XmlElement(name="Image")
    private List<WechatImageMessage.Image> image;


    @XmlAccessorType(XmlAccessType.FIELD)
    @Data
    @AllArgsConstructor(access = AccessLevel.PUBLIC)
    @NoArgsConstructor(access = AccessLevel.PUBLIC)
    public static  class Image implements Serializable {
        private static final long serialVersionUID = 791807025293606500L;
        /**
         * 图片媒体id
         */
        @NonNull
        @XmlElement(name="MediaId")
        private String mediaId;

    }

}
